<?php

class Item {
	public function Item($title, $image, $link, $date, $description) {
		$this->title = $title;
		$this->image = $image;
		$this->link = $link;
		$this->date = $date;
		$this->description = $description;
	}
	public function getRss() {
		$kImageFormat = "<img src=\"%s\"/>";
		$imagesData = "";
		if (is_array ( $this->images )) {
			foreach ( $this->images as $image ) {
				if (strlen ( $image ) == 0) {
					continue;
				}
				$imagesData .= sprintf ( $kImageFormat, $image );
			}
		} else if (strlen ( $this->images ) > 0) {
			$imagesData .= sprintf ( $kImageFormat, $this->images );
		}
		
		return "<item>" . PHP_EOL . "<title>" . $this->title . "</title>" . PHP_EOL . "<link>" . $this->link . "</link>" . PHP_EOL . "<pubDate>" . $this->date . "</pubDate>" . PHP_EOL . "<description>" . "<![CDATA[" . $imagesData . $this->description . "]]>" . "</description>" . PHP_EOL . "</item>" . PHP_EOL;
	}
	public function link() {
		return $this->link;
	}
	public function setLink($link) {
		return $this->link = $link;
	}
	public function description() {
		return $this->description ();
	}
	public function setDescription($des) {
		$this->description = $des;
	}
	public function setWidth($width) {
		$this->width = $width;
	}
	public function setHeight($height) {
		$this->height = $height;
	}
	public function image() {
		return $this->image;
	}
	public function setImage($image) {
		$this->image = $image;
	}
	var $title;
	var $link;
	var $date;
	var $description;
	var $image;
	var $height;
	var $width;
}

?>